import App from './App'

// #ifndef VUE3
import Vue from 'vue'
Vue.config.productionTip = false
// 定义全局过滤器
// 时间
Vue.filter('datetime', (num) => {
	let d = new Date(num)
	let yy = d.getFullYear()
	let mm = d.getMonth() + 1
	mm < 10 ? mm = '0' + mm : mm
	let dd = d.getDate()
	dd < 10 ? dd = '0' + dd : dd
	let hh = d.getHours()
	hh < 10 ? hh = '0' + hh : hh
	let minut = d.getMinutes()
	minut < 10 ? minut = '0' + minut : minut
	return `${yy}年${mm}月${dd}日 ${hh}:${minut}`
})
// 月份
Vue.filter('datemonth', (num) => {
	if (num == 0) {
		return '月份'
	} else {
		let d = new Date(num)
		let yy = d.getFullYear()
		let mm = d.getMonth() + 1
		mm < 10 ? mm = '0' + mm : mm
		return `${yy}-${mm}`
	}

})
// 类型转换名称
// -1-缴费类型 0-全部 1-水费 2-电费……
Vue.filter('feeType', num => {
	let name = ''
	switch (num) {
		case -1:
			name = '缴费类型'
			break;
		case 0:
			name = '全部'
			break;
		case 1:
			name = '水费'
			break;
		case 2:
			name = '电费'
			break;
		case 3:
			name = '燃气费'
			break;
		case 4:
			name = '物业费'
			break;
		case 5:
			name = '停车费'
			break;
		case 6:
			name = '宽带费'
			break;
		default:
			name = '其他费用'
	}
	return name
})

// 类型转换成对应的图标
// 0-全部 /static/img/shui.png -水费  /static/img/dian.png-电费……
Vue.filter('feeTypeIcon', num => {
	let url = '/static/img/'
	switch (num) {
		case 1:
			url += 'shui.png'
			break;
		case 2:
			url += 'dian.png'
			break;
		case 3:
			url += 'ranqi.png'
			break;
		case 4:
			url += 'wuye.png'
			break;
		case 5:
			url += 'tingche.png'
			break;
		case 6:
			url += 'kuandai.png'
			break;
		default:
			url += 'other.png'
	}
	return url
})

App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif
